import 'dart:async';

import 'package:flutter/material.dart';

class ClickState with ChangeNotifier {

  DateTime _dateTime = DateTime.now();

  Timer _timer;

  ClickState() {
    this._timer = initTimer();
  }

  DateTime get dateTime => _dateTime;

  Timer initTimer() {
    return Timer.periodic(Duration(milliseconds: 1), (t) {
      _dateTime = DateTime.now();
      notifyListeners();
    });
  }

  void cancelTimer() {
    _timer?.cancel();
  }

}